<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script src="js/jquery.js"></script>
<div id="ret"></div>
<script>
    var ret = document.getElementById("ret");

    function func(url, info){
        // 发送 AJAX 请求
        $.ajax({
            url: url,
            type: "POST",
            contentType: "application/json; charset=UTF-8",
            data: JSON.stringify(info),
            success: function (response) {
                ret.innerHTML = "successful";
                console.log("Request successful!");
            },
            error: function (xhr, status, error) {
                ret.innerHTML = "failed";
                console.error("Request failed:", error);
            }
        });
    }

    // 客流单点修改
    var url = "http://localhost:8080/rtd/lineFlow";
    var info = {
        lineName: "line3",
        passengerFlow: 666
    };
    setTimeout(func, 2000, url, info);

    // 滞留
    var url = "http://localhost:8080/rtd/staLinger";
    var info = {
        stationList:[
            { name: "十里店", linger: 3.7 },
            { name: "东郊记忆", linger: 6.2 },
            { name: "春熙路", linger: 7.1 }
        ]
    };
    setTimeout(func, 3000, url, info);

    // 饼图
    var url = "http://localhost:8080/rtd/transfer";
    var info = {
        name: "火车东站",
        distribute: [
            {lineName: "9", passengerFlow: 400},
            {lineName: "8", passengerFlow: 310},
            {lineName: "5", passengerFlow: 300},
        ]
    };
    setTimeout(func, 4000, url, info);

</script>
</body>
</html>